# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>

buildarch=8

pkgname=firmware-dragonboard410c
pkgver=1.4.0
pkgrel=2
pkgdesc="Additional firmware for Dragonboard 410c"
arch=('aarch64')
url="https://archlinuxarm.org"
license=('custom')
makedepends=('bc')
replaces=('firmware-dragonboard')
options=('!strip')
source=("https://developer.qualcomm.com/download/db410c/firmware-410c-${pkgver}.bin")
sha256sums=('822d2f8506d9657dbce6aa2bfce81ccbf97dcfc40831b70703b14b3f296fa4c0')

prepare() {
  sh firmware-410c-${pkgver}.bin --auto-accept
}

package() {
  install -d "${pkgdir}/usr/lib/firmware"
  cp -a linux-board-support-package-v${pkgver%.0}/proprietary-linux/* "${pkgdir}/usr/lib/firmware"
  rm "${pkgdir}/usr/lib/firmware/firmware.tar"
  rm "${pkgdir}"/usr/lib/firmware/a300_{pfp,pm4}.fw
  install -D -m644 linux-board-support-package-v${pkgver%.0}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
